<template>
  <div class="reward">
    <div class="reward-header">
      <div class="h-card">
        <img :src="prefixOssUrl('member/supreme-icon.png')" />
        <div class="h-card_right">
          <div class="r-name">
            至尊奖励(元)<span>账户</span>
          </div>
          <div class="r-num">989989998</div>
        </div>
      </div>
      <div class="h-card">
        <img :src="prefixOssUrl('member/market-icon.png')" />
        <div class="h-card_right">
          <div class="r-name">
            股东奖励（元）<span>现金</span>
          </div>
          <div class="r-num">989989998</div>
        </div>
      </div>
      <div class="h-card">
        <div class="h-card_right">
          <div class="r-name">
            未发放奖励（元）<span>现金</span>
          </div>
          <div class="r-num">989989998</div>
        </div>
      </div>
      <div class="h-card">
        <div class="h-card_right">
          <div class="r-name">
            已发放奖励（元）
            <n-tooltip placement="bottom" trigger="click">
              <template #trigger>
                <div class="n-icon iconfont icon-yiwenshuoming"></div>
              </template>
              <p>账户：￥2323</p>
              <p>现金：￥23232</p>
            </n-tooltip>
            <span>账户/现金</span>
          </div>
          <div class="r-num">989989998</div>
        </div>
      </div>
    </div>
    <div class="reward-body">
      <div class="reward-body_search">
        <div class="reward-body_search-item">
          <span>搜索会员</span>
          <n-input type="text" style="width:380px" placeholder="请输入会员姓名/手机号" clearable />
        </div>
        <div class="reward-body_search-item">
          <span>选择日期</span>
          <n-date-picker style="width:440px" type="daterange" separator="-" clearable />
        </div>
        <button class="reward-body_search-reset">重置</button>
      </div>
      <div class="reward-body_table">
        <n-data-table :striped="true" :columns="columns" :data="data" :max-height="580" />
      </div>
      <div class="reward-body_pagination">
        <n-pagination :page-count="100">
          <template #prev>
            上一页
          </template>
          <template #next>
            下一页
          </template>
          <template #suffix>
            <div class="reward-body_pagination__jump-page">
              到<input type="number">页
              <button>确认</button>
            </div>
          </template>
        </n-pagination>
      </div>
    </div>
  </div>
  <info-drawer></info-drawer>
</template>

<script setup>
import { h, ref, reactive, inject, provide } from "vue";
import { NButton } from "naive-ui";
import infoDrawer from './info.vue';

const { prefixOssUrl } = inject('globalMethods')
let rewardInfoDrawerActive = ref(false);
provide('rewardInfoDrawerActive', rewardInfoDrawerActive);

const columns = [{
  title: '订单编号',
  key: 'name',
  width: 200
},
{
  title: '会员姓名',
  key: 'mobile'
},
{
  title: '会员电话',
  key: 'mobile'
},
{
  title: '会员类型',
  key: 'type'
},
{
  title: '订单金额（￥）',
  key: 'shop',
},
{
  title: '操作',
  key: 'actions',
  fixed: 'right',
  width: 350,
  render (row) {
    return [h(
      NButton, {
      size: 'small',
      type: 'info',
      secondary: true,
      onClick: () => {
        rewardInfoDrawerActive.value = true;
      }
    }, {
      default: () => "查看详情"
    }
    )]
  }
}
]
const data = reactive([
  {
    key: 0,
    name: 'John Brown',
    mobile: 32,
    type: '至尊会员',
    shop: 'New York No. 1 Lake Park'
  }
])

</script>

<style lang="less" scoped>
.reward {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #ececec;
  &-header {
    display: flex;
    align-items: center;
    height: 136px;
    padding: 0 30px;
    margin-bottom: 10px;
    background: #fff;
    .h-card {
      display: flex;
      align-items: center;
      width: 300px;
      height: 76px;
      padding: 10px;
      margin-right: 20px;
      background: #f7f7f7;
      border-radius: 4px;
      img {
        width: 64px;
        height: 64px;
        margin-right: 20px;
      }
      &_right {
        height: 64px;
        .r-name {
          display: flex;
          align-items: center;
          height: 30px;
          font-size: 18px;
          font-weight: 500;
          color: #2e323d;
          .n-icon {
            font-size: 30px;
            color: #fe9900;
          }
          > span {
            padding: 5px 20px;
            margin-left: 10px;
            font-size: 14px;
            font-weight: 500;
            color: #999;
            background: #e5e5e5;
          }
        }
        .r-num {
          height: 34px;
          font-size: 26px;
          font-weight: bold;
          color: #4a5060;
        }
      }
    }
  }
  &-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #fff;
    &_search {
      display: flex;
      align-items: center;
      height: 60px;
      padding: 0 30px;
      margin: 20px 0;
      &-item {
        display: flex;
        align-items: center;
        &:nth-child(1) {
          margin-right: 60px;
        }
        > span {
          margin-right: 20px;
          font-size: 26px;
          font-weight: 500;
          color: #2e323d;
        }
      }
      &-reset {
        width: 114px;
        height: 60px;
        margin-left: 20px;
        font-size: 26px;
        font-weight: 500;
        color: #4a5060;
        background: #f8f8f8;
        border: 1px solid #aaa;
        border-radius: 5px;
      }
    }
    &_table {
      flex: 1;
      padding: 0 30px;
    }
    &_pagination {
      display: flex;
      align-items: center;
      height: 128px;
      padding: 0 30px;
      box-shadow: 0px 3px 7px 0px rgba(0, 0, 0, 0.2);
      &__jump-page {
        font-size: 26px;
        color: #4a5060;
        margin: 0 18px;

        input {
          margin: 0 15px;
          width: 64px;
          height: 42px;
          background: #f8f8f8;
          border: 1px solid #e5e5e5;
          border-radius: 5px;
          text-align: center;
        }

        button {
          margin: 0 30px;
          width: 88px;
          height: 44px;
          color: #fdfdfd;
          background: #2c8cf0;
          border-radius: 5px;
        }
      }
    }
  }
}
</style>
